<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/semantic-ui/2.2.4/semantic.min.css" >
</head>
<body>
<div class="ui container">
    <div class="ui top aligned teal segment">
        <p class="ui middle aligned attached">CRUD-INPUT</p>
    </div>
    <form class="ui form" action="#" th:object="${resource}" th:action="${resource.resource_id}==null ?  @{/insertReource} : @{/updateResource/{id}(id=${resource.resource_id})}"  method="post">
        <div class="field">
            <label>资源审核状态</label>
            <div class="ui selection dropdown" style="width: 80px">
                <input type="hidden" name="resource_status" th:value="${resource.resource_status}">
                <i class="dropdown icon"></i>
                <div class="default text">审核状态状态</div>
                <div class="menu">
                    <div class="item" data-value="已审核">已审核</div>
                    <div class="item" data-value="待审核">待审核</div>
                </div>
            </div>
        </div>
        <div class="field">
            <label>资源名称</label>
            <input type="text" name="resource_name" th:value="${resource.resource_name}" placeholder="资源名称">
        </div>
        <div class="field">
            <label>资源简介</label>
            <input type="text" name="resource_introduce" th:value="${resource.resource_introduce}" placeholder="资源简介">
        </div>
        <div class="field">
            <label>资源大小</label>
            <input type="text" name="resource_size" th:value="${resource.resource_size}" placeholder="资源大小">
        </div>
        <div class="field">
            <label>资源上传人</label>
            <input type="text" name="resource_uploader" th:value="${resource.resource_uploader}" placeholder="资源上传人">
        </div>
        <div class=" field">
            <div class="ui left labeled action input">
                <label class="ui compact teal basic label">课程所属</label>
                <div class="ui fluid selection multiple search  dropdown">
                    <input type="hidden" name="courseString" th:value="${resource.getCourseString()}">
                    <i class="dropdown icon"></i>
                    <div class="default text">课程所属</div>
                    <div class="menu">
                        <div th:each="tag : ${resource.getResource_course()}" class="item"  th:data-value="${tag.getCourse_id()}" th:text="${tag.getCourse_name()}">java</div>
                    </div>
                </div>
            </div>
        </div>
        <br>
        <button class="ui teal button" type="submit">完成</button>
        <div class="ui error message"></div>
    </form>
</div>

<script src="https://cdn.jsdelivr.net/npm/jquery@3.2/dist/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/semantic-ui/2.2.4/semantic.min.js"></script>
<script>

    $('.dropdown')
        .dropdown({
            clearable: true
        })
    ;
</script>
</body>
</html>